# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.

# 2020_11_29 commit
import time

from django.test import LiveServerTestCase
from selenium import webdriver
import unittest
from selenium.webdriver.common.keys import Keys

# 使用LiveServerTestCase，可以每次运行时都清楚掉数据库
# 保证功能测试正常运行


class myTest(LiveServerTestCase):
    def setUp(self):
        self.browser = webdriver.Firefox()
        #等待页面元素加载ok
        self.browser.implicitly_wait(5)

    def tearDown(self):
        # self.browser.close()
        pass

    def check_for_row_in_list_table(self, row_text):
        table = self.browser.find_element_by_id('id_list_table')
        rows = table.find_elements_by_tag_name('tr')
        self.assertIn(row_text, [row.text for row in rows])  # 判断在不在

    def test_chrome(self):
        self.browser.get(self.live_server_url)
        self.assertIn('To-Do lists', self.browser.title)

    def test_cannot_add_empty_list_items(self):

        self.fail('wait me')


# if __name__ == '__main__':
#     unittest.main(warnings='ignore')






# See PyCharm help at https://www.jetbrains.com/help/pycharm/
